<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Comment;

class CommentController extends Controller
{
    public function createPost(Request $request){
    	$this->validate($request,[
    			'content' => 'required',
    			'discussion_id' => 'required'
    		]);
    	$userId = ['user_id' => \Auth::user()->id];
    	Comment::create(array_merge($request->all(),$userId));
    	return redirect('post/show/'.$request->get('discussion_id'));
    }
}
